<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script >
	function getXhr(){
		
		var xhr=null;
		if(window.XMLHttpRequest){
			//非ie浏览器
			xhr=new XMLHttpRequest();
		}else{
			//是ie浏览器
			xhr=new ActiveXObject('MicroSoft.XMLHttp');
			
		}
		
		return xhr;
		
	}

</script>

</head>
<body style="font-size:30px;">
	<a href="javascript:alert(getXhr());">ClickMe</a>
</body>
</html>

























